package collection;

import java.util.ArrayList;
import java.util.Collection;

public class CollectionDemo4 {
    public static void main(String[] args) {
        Collection<Point> c = new ArrayList<>();//超类型的引用 指向 派生类的对象
        Point p = new Point(1,2);
        c.add(p);
        System.out.println(p);
        System.out.println(c);
        p.setX(2);//集合中存的地址，改变对象也将改变集合地址指向引用的对象
        System.out.println(p);
        System.out.println(c);



    }
}
